using System.Threading.Tasks;

namespace ThingsGateway.Foundation.Rpc.TouchRpc
{
    /// <summary>
    /// ITouchRpcService
    /// </summary>
    public interface ITouchRpcService : IRpcParser, ITargetRpcActor
    {
        /// <summary>
        /// 向对应ID的客户端发送
        /// </summary>
        /// <param name="targetId">目标ID</param>
        /// <param name="protocol">协议</param>
        /// <param name="buffer">数据</param>
        /// <param name="offset">偏移</param>
        /// <param name="length">长度</param>
        /// <exception cref="NotConnectedException">未连接异常</exception>
        /// <exception cref="ClientNotFindException">未找到ID对应的客户端</exception>
        /// <exception cref="Exception">其他异常</exception>
        void Send(string targetId, short protocol, byte[] buffer, int offset, int length);

        /// <summary>
        /// 向对应ID的客户端发送
        /// </summary>
        /// <param name="targetId">目标ID</param>
        /// <param name="protocol">协议</param>
        /// <param name="buffer">数据</param>
        /// <param name="offset">偏移</param>
        /// <param name="length">长度</param>
        /// <exception cref="NotConnectedException">未连接异常</exception>
        /// <exception cref="ClientNotFindException">未找到ID对应的客户端</exception>
        /// <exception cref="Exception">其他异常</exception>
        Task SendAsync(string targetId, short protocol, byte[] buffer, int offset, int length);
    }
}